﻿using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;

namespace cshape_demo2
{
    public class HttpUtil
    {
        public static HttpClient Client = null;

        static HttpUtil()
        {
            HttpClientHandler clientHandler = new HttpClientHandler();
            clientHandler.AllowAutoRedirect = false;
            Client = new HttpClient(clientHandler);
            Client.DefaultRequestHeaders.Add("my-head", "1");
        }

        public String Get(String url, Dictionary<String, Object> date)
        {
            try
            {
                Task<string> task = Client.GetStringAsync(url);
                task.Wait();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return "";
        }

    }
}